package com.yazi.mxz.job.controller;

import javax.annotation.Resource;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.myframework.smhj.jackson.result.StatusResult;
import com.yazi.mxz.job.quartz.SmsJob;

@Controller("smsController")
@RequestMapping("/sms")
public class SmsController {

	private static Logger log = LoggerFactory.getLogger(SmsController.class);

	@Resource
	SmsJob smsJob;

	@RequestMapping
	@ResponseBody
	public StatusResult json() {
		log.debug("远程请求短信发送任务");
		StatusResult jsonResult = new StatusResult();
		try {
			smsJob.checkDoit();
			jsonResult.setOkMessage("ok");
		} catch (Exception e) {
			log.warn("短信发送任务执行异常: ", e);
			jsonResult.setErrorMessage(e.getMessage());
		}
		return jsonResult;
	}
	
}
